<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <%- include common %>
</head>
<body>
    <%- include('head', {title: 'login', username: ''}) %>

    <div class="container-fluid">
        <div class="container">
            <h3 class="text-primary">欢迎登录</h3>

            <div class="row">
              <div class="col-md-4 col-sm-6 col-xs-12">
                <ul class="nav nav-tabs">
                  <li id="li-one" role="presentation" class="active"><a onclick="changeShow(true)">用户名登录</a></li>
                  <li id="li-two" role="presentation"><a onclick="changeShow(false)">手机号登录</a></li>
                </ul>
              </div>
            </div>

            <div class="row" style="margin-top: 15px;">
                <div class="col-md-4 col-sm-6 col-xs-12">
                    <form method="POST" action="/users/signin">
                      <div class="form-group" id="usernamebox">
                        <label for="username">用户名</label>
                        <input type="text" name="username" value="<%- username %>" class="form-control" id="username" placeholder="请输入用户名">
                      </div>
                      <div class="form-group" id="phonebox">
                        <label for="phone">手机号码</label>
                        <input type="number" name="phone" class="form-control" id="phone" placeholder="请输入手机号码">
                      </div>
                      <div class="form-group">
                        <label for="password">密码</label>
                        <input type="password" name="password" class="form-control" id="password" placeholder="请输入密码">
                      </div>
                      <div class="checkbox">
                        <label>
                          <input type="checkbox"> 记住密码
                        </label>
                      </div>
                      <button type="submit" class="btn btn-primary">登录</button>
                      <button type="reset" class="btn btn-danger">重置</button>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <%- include foot %>


    <script>
      window.onload = function() {
        $("#usernamebox").show()
        $("#phonebox").hide()
      }

      function changeShow(flag) {
        if(flag){
          $("#usernamebox").show()
          $("#phonebox").hide()
          $("#li-one").addClass("active")
          $("#li-two").removeClass("active")
        }else{
          $("#usernamebox").hide()
          $("#phonebox").show()
          $("#li-one").removeClass("active")
          $("#li-two").addClass("active")
        }
      }
    </script>
</body>
</html>